package com.gemme.gemme;

import android.text.TextUtils;
import android.widget.Toast;

import com.alibaba.fastjson.JSON;
import com.gemme.gemme.login.Constant;
import com.gemme.gemme.login.UseInfoBean;
import com.gemme.gemme.manager.DataManager;

import java.io.IOException;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class RefreshUtil {
    public static  void refresh(){
      /*  String url = DataManager.BaseUrl + "auth/oauth/token?";
        OkHttpClient okHttpClient = new OkHttpClient();
        if(TextUtils.isEmpty(Constant.REFRESH_TOKEN)){
//            Toast.makeText(context, "手机号和验证码不能为空", Toast.LENGTH_SHORT).show();
            // todo relogin()


            return;
        }
        url = url + "refresh_token=" + Constant.REFRESH_TOKEN
                +"&scope=" + "server"+
                "&grant_type="+ "refresh_token";
        RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"),"");

        Request request = new Request.Builder()
                .post(body).url(url)
                .addHeader("Authorization", DataManager.Authorization)
                .build();

        Call call = okHttpClient.newCall(request);
        call.enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {
                System.out.println("");
            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                String str = response.body().string();
                System.out.println("");

            }
        });*/



    }
}
